﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class TestingInputSystem : MonoBehaviour
{
    private PlayerInput playerInput;
    private CharacterController characterController;
    private PlayerInputActions playerInputActions;

    private void Awake()
    {
        playerInput = GetComponent<PlayerInput>();
        characterController = GetComponent<CharacterController>();
        playerInputActions = new PlayerInputActions();

        playerInputActions.PlayerControl.Enable();
        playerInputActions.PlayerControl.Attack.performed += Attack;
        playerInputActions.PlayerControl.Attack.performed += Movement;
    }

    private void FixedUpdate()
    {
        Vector2 inputVector = playerInputActions.PlayerControl.Movement.ReadValue<Vector2>();
        float speed = 5f;
        characterController.Move(new Vector3(inputVector.x, 0, inputVector.y) * speed * Time.deltaTime);
    }

    public void Attack(InputAction.CallbackContext context)
    {
        Debug.Log("Attack" + context.phase);
    }

    public void Movement(InputAction.CallbackContext context)
    {
        
    }
}
